home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / percnt.zip / CTRLCOMM.PAS < prev    next >
Pascal/Delphi Source File  |  1991-11-10  |  3KB  |  83 lines

  1. {***************************************************************************
  2.  
  3.     NoMan Custom Control Library            $Version$
  4.     Common Definitions Code Unit
  5.     $Author$        $Date$
  6.  
  7.         Copyright 1991 Anthony M. Vitabile
  8.  
  9.     Unit Description
  10.  
  11.     This Turbo Pascal for Windows unit contains the code used to
  12.     initialize a DLL containing several new kinds of control windows
  13.     for use in dialog boxes.  The code in this module defines common
  14.     declarations used by all the modules that comprise this library.
  15.  
  16.     The library uses straight Windows calls and does NOT use Object-
  17.     Windows.  This is to allow the control to be used by ANY Windows
  18.     program.  In addition, the use of OWL in DLLs is not supported
  19.     at this time.
  20.  
  21.     This code is adapted from the code that appeared in the July,
  22.     1990 issue of Microsoft Systems Journal article, "Extending the
  23.     Windows 3.0 Interface with Installable Custom Controls" by Kevin
  24.     P. Welch.
  25.  
  26.     The DLL obeys the rules specified by Borland for compatibility
  27.     with its Resource Workshop resource editor.
  28.  
  29. ***************************************************************************}
  30.  
  31. Unit CtrlCommonDefs;
  32.   Interface
  33.     Uses WinTypes;
  34.  
  35.   const
  36.     Ctl_NoControls = 1;            { Currently only have 1 control in the DLL }
  37.  
  38.                          { Percent Control Constants }
  39.  
  40.     PctNoStyles  = 5;                   { Number of style bits we define }
  41.  
  42.     Pct_Decades :  longint = $01;    { Place tick marks & % values every 10% }
  43.     Pct_Quarters:  longint = $02;    { Place tick marks & % values every 25% }
  44.     Pct_Halves  :  longint = $04;    { Place tick marks & % values every 50% }
  45.     Pct_Axis    :  longint = $08;    { Draw the tick marks on the control }
  46.     Pct_Digits  :  longint = $10;    { Draw the percentage in the middle of the control }
  47.  
  48.     Pct_ClassExtra = 0;            { Number of extra bytes to allocate in the class }
  49.     Pct_ClassStyle = cs_HRedraw or cs_VRedraw or cs_GlobalClass;
  50.     Pct_Color      = 0;            { The background color of the control }
  51.     Pct_Name       = 'PercentCtrl';    { Class name for the new control }
  52.     Pct_NoVariants = 1;            { 5 different variants on this control }
  53.     Pct_Version    = 100;        { Version number is 1.00 }
  54.     Pct_WndExtra   = 2;            { Number of extra bytes to allocate in the window }
  55.     Pct_Percentage = 0;            { GetWindowWord offset of the current percentage }
  56.  
  57.             { Define window messages }
  58.  
  59.     pcm_ResetPercent = wm_User + 1;    { Message to cause control to reset % to 0 }
  60.     pcm_AddPercent   = wm_User + 2;    { Message to cause control to add x % }
  61.     pcm_GetPercent   = wm_User + 3;    { Message to cause control to return its current setting }
  62.     pcm_SetPercent   = wm_User + 4;    { Message to cause control to set itself to x% }
  63.                     { Control Style Dialog box identifiers }
  64.     PctMask:  longint = $FFFFFFF8;
  65.  
  66.   type
  67.     StyleArray = array [0 .. CtlTypes - 1] of longint;
  68.     VarNameArr = array [0 .. CtlTypes - 1] of PChar;
  69.  
  70.   var
  71.     Pct_WndStyle:  StyleArray;
  72.     Pct_Variants:  VarNameArr;
  73.  
  74.   Implementation
  75.     const
  76.       CommonStyle:  longint = ws_Child or ws_Visible;
  77.  
  78.   begin
  79.     Pct_WndStyle[0] := CommonStyle;
  80.  
  81.     Pct_Variants[0] := Pct_Name;
  82.   end.
  83.